<cftry>

	<cfparam name="recipientsWDDX" type="xml">
	<cfparam name="from" type="string" default="">
	<cfparam name="subject" type="string" default="">
	<cfparam name="message" type="string" default="">
	<cfparam name="format" type="string" default="">
	<cfparam name="rv" type="string" default="composeEmail">
	<cfwddx action="wddx2cfml" input="#recipientsWDDX#" output="recipientsArray">
	
	<cfoutput>
	
		<cfif IsArray(recipientsArray) and ArrayLen(recipientsArray) gt 0>
	
			<cfset recipientStruct = recipientsArray[1]>
			<cfset testMessage = ReplaceNoCase(message, "%firstName%", recipientStruct.firstName, "all")>
			<cfset testMessage = ReplaceNoCase(testMessage, "%lastName%", recipientStruct.lastName, "all")>
			<cfset testMessage = ReplaceNoCase(testMessage, "%organization%", recipientStruct.organization, "all")>
			<cfset testMessage = ReplaceNoCase(testMessage, "%email%", recipientStruct.email, "all")>
			<cfif StructKeyExists(recipientStruct, "claimID")>
				<cfset testMessage = ReplaceNoCase(testMessage, "%claimID%", recipientStruct.claimID, "all")>
			</cfif>
	
			<cfset testSubject = ReplaceNoCase(subject, "%firstName%", recipientStruct.firstName, "all")>
			<cfset testSubject = ReplaceNoCase(testSubject, "%lastName%", recipientStruct.lastName, "all")>
			<cfset testSubject = ReplaceNoCase(testSubject, "%organization%", recipientStruct.organization, "all")>
			<cfset testSubject = ReplaceNoCase(testSubject, "%email%", recipientStruct.email, "all")>
			<cfif StructKeyExists(recipientStruct, "claimID")>
				<cfset testSubject = ReplaceNoCase(testSubject, "%claimID%", recipientStruct.claimID, "all")>
			</cfif>
	
			<cfform name="emailForm" id="emailForm" action="#script_name#" method="post">
				<cfinput type="hidden" name="recipientsWDDX" value="#xmlFormat(recipientsWDDX)#">
				<cfinput type="hidden" name="from" value="#from#">
				<cfinput type="hidden" name="subject" value="#subject#">
				<cfinput type="hidden" name="message" value="#message#">
				<cfinput type="hidden" name="format" value="#format#">
				<cfinput type="hidden" name="m" value="sendUserEmails">
				<cfinput type="hidden" name="view" value="emailSent">
	
				<style type="text/css">
					.mailContainer table {
						display: none;
						visibility: hidden;
					}
					.mailContainer table.visible {
						display: block;
						visibility: visible;
					}
					.mailContainer center {
						text-align: left;
					}
					.mailContainer a {
						text-decoration: underline;
					}
				</style>
				<div class="buttonBar">
					<a href="" onClick="history.go(-1); return false;" class="formLink2">Back</a>
					<cfinput type="submit" name="sendButton" id="sendButton" value="Send" class="formButton">
				</div>
	
				<p><strong>Subject:</strong> #testSubject#</p>
	
	
				<cfif format eq "HTML">
	
	
					<table width="800" cellpadding="8" style="border: solid 1px silver;">
						<tr>
							<td><img src="http://www.calgrants.org/applications/admin/common/images/smlogo.gif" height="51" width="200" border="0" alt="Cash for College logo" style="margin-bottom: 10px;"></td>
						</tr>
						<tr>
							<td class="mailContainer">#testMessage#</td>
						</tr>
					</table>
	
					<cfinput type="hidden" name="testMessage" value="#testMessage#">
	
				<cfelse>
	
					<cftextarea name="testMessage" value="#testMessage#" style="width: 800px; height: 400px;"></cftextarea>
	
				</cfif>
	
			</cfform>
	
		<cfelse>
	
			<p class="noRecords">(No recipients selected)</p>
	
		</cfif>
	
	</cfoutput>
	
	<cfcatch type="any">
		<cfdump var="#cfcatch#">
		<cfdump var="#form#">
	</cfcatch>
</cftry>